package com.example.newdemo.base;

import android.os.Parcel;
import android.os.Parcelable;

public class ParcelableTestDemo implements Parcelable {

    public int id;
    public String name;
    public int type;


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeString(this.name);
        dest.writeInt(this.type);
    }

    public void readFromParcel(Parcel source) {
        this.id = source.readInt();
        this.name = source.readString();
        this.type = source.readInt();
    }

    public ParcelableTestDemo() {
    }

    protected ParcelableTestDemo(Parcel in) {
        this.id = in.readInt();
        this.name = in.readString();
        this.type = in.readInt();
    }

    public static final Creator<ParcelableTestDemo> CREATOR = new Creator<ParcelableTestDemo>() {
        @Override
        public ParcelableTestDemo createFromParcel(Parcel source) {
            return new ParcelableTestDemo(source);
        }

        @Override
        public ParcelableTestDemo[] newArray(int size) {
            return new ParcelableTestDemo[size];
        }
    };
}
